//Page Object
Page({
  data: {
    tabs: [{
      id: 0,
      value: "全部订单",
      isActive: true
    },
    {
      id: 1,
      value: "待付款",
      isActive: false
    },
    {
      id: 2,
      value: "待发货",
      isActive: false
    },
    {
      id: 3,
      value: "退货/退款",
      isActive: false
    }
    ],
  },
  //options(Object)
  onLoad: function (options) {
    console.log(options)
    const { type } = options
    let { tabs } = this.data
    tabs.forEach((v, i) => {
      i === type - 1 ? v.isActive = true : v.isActive = false
    })
    this.setData({ tabs })
  },
  onTabsItemChange(e) {
    // console.log(e);
    const { index } = e.detail
    let { tabs } = this.data
    tabs.forEach((v, i) => {
      i === index ? v.isActive = true : v.isActive = false
    })
    this.setData({ tabs })
  }

});